<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>表格组件的使用</title>
		<link rel="stylesheet" type="text/css" href="css/antd.css" />
		<style type="text/css">
			* {
				margin: 0;
				padding: 0;
			}
			#app{
				margin: 50px 20px;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<a-table v-bind="attrs" :columns="columns" bordered>
				<span slot="id" slot-scope="text">
					<a href="javascript:;" @click="doRemove(text)">删除</a>
				</span>
			</a-table>
		</div>

		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/antd.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			var vm = new Vue({
				el: "#app",
				data: {
					columns: [{
						title:"姓名",dataIndex:"name",key:"name",align:"center"
					},{
						title:"年龄",dataIndex:"age",key:"age",align:"center"
					},{
						title:"住址",dataIndex:"addrss",key:"addrss",align:"center"
					},{
						title:"操作",dataIndex:"id",key:"id",align:"center",
						scopedSlots:{
							customRender:"id"
						}
					}],
					attrs: {
						dataSource: [{id: 1,name: "张三",age: 20,addrss: "云南"},
									{id: 2,name: "李四",age: 21,addrss: "四川"}, 
									{id: 3,name: "王五",age: 22,addrss: "贵州"}, 
									{id: 4,name: "赵六",age: 23,addrss: "北京"}, 
									{id: 5,name: "钱七",age: 24,addrss: "上海"}],
						rowkey: "id"
					}
				},
				methods: {
					doRemove: function(id) {
						this.$message.warn("删除数据");
					}
				},
			});
		</script>
	</body>
</html>
